package com.ldkj.panzh.controller;

import com.ldkj.panzh.domain.AjaxResult;
import com.ldkj.panzh.domain.TableDataInfo;
import com.ldkj.panzh.param.VehicleRecordParam;
import com.ldkj.panzh.service.VehicleRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 车辆记录查询 控制器
 *
 * @author qiancheng
 * @date 2025-11-19
 */
@Controller
public class VehicleRecordController extends BaseController {

    @Autowired
    VehicleRecordService vehicleRecordService;

    /**
     * 查询车辆过车记录
     *
     * @param vehicleRecordParam 查询参数
     * @return 车辆记录列表
     * @throws Exception
     */
    @RequestMapping("/queryVehicleRecords")
    @ResponseBody
    public TableDataInfo queryVehicleRecords(@RequestBody VehicleRecordParam vehicleRecordParam) throws Exception {
        return getDataTable(vehicleRecordService.queryVehicleRecords(vehicleRecordParam));
    }

    /**
     * 查询车辆统计信息
     *
     * @param vehicleRecordParam 查询参数
     * @return 统计数据（总数、车辆类型分布、进出统计等）
     * @throws Exception
     */
    @RequestMapping("/queryVehicleStats")
    @ResponseBody
    public AjaxResult queryVehicleStats(@RequestBody VehicleRecordParam vehicleRecordParam) throws Exception {
        return success(vehicleRecordService.queryVehicleStats(vehicleRecordParam));
    }
}
